package app.controllers.admin.stat;

import app.models.game.GameJoinrecord;
import app.models.member.TicketOptRecord;
import com.github.sog.controller.BasicController;
import com.github.sog.controller.datatables.core.DatatablesCriterias;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

/**
 * <p>
 * .
 * </p>
 *
 * @author Jerry Ou
 * @version 1.0 2014-06-05 16:01
 * @since JDK 1.6
 */
public class TicketController extends BasicController {

    public void index() {
        render("index.ftl");
    }

    public void list() {
        String start = getPara("start");
        String end = getPara("end");
        String oper = getPara("oper");

        final DatatablesCriterias criterias = getCriterias();

        Page<Record> page = TicketOptRecord.dao.optstat(criterias, start, end, oper);
        renderDataTables(page, criterias);
    }

    public void detail() {
        String optDate = getPara("optDate");
        String real_name = getPara("real_name");
        String name = getPara("name");
        long customer = getParaToLong("customer", 0l);

        setAttr("optDate", optDate);
        setAttr("customer", customer);
        setAttr("name", name);
        setAttr("real_name", real_name);
        render("detail.ftl");
    }

    public void detailList() {
        String optDate = getPara("optDate");
        long customer = getParaToLong("customer", 0l);
        String member = getPara("member");
        String ticket = getPara("ticket");

        setAttr("optDate", optDate);
        setAttr("customer", customer);

        final DatatablesCriterias criterias = getCriterias();

        Page<Record> page = TicketOptRecord.dao.detailList(criterias, optDate, customer, member, ticket);
        renderDataTables(page, criterias);
    }

}
